{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{1, 2, 3, 5, 6}"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "set([1,1,1,2,3,6,5,5,5])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "_COMMAND = '\\S*\\s+'.join('all'.split()) + '\\S*'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'all\\\\S*'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r'\\S*\\s+'.join('all'.split()) + r'\\S*'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "{'华为设备核对snetconf': \n",
    "    ([[{'DEVICE_NAME': 'SNANK-MC-CMNET-BRAS01-SCEC/X16', 'snetconf': '', 'netconf': 'netconf'}], [{'DEVICE_NAME': 'SNANK-MC-CMNET-BRAS01-SCEC/X16', 'snetconf': '', 'netconf': 'netconf'}, {'DEVICE_NAME': 'SNANK-MC-CMNET-BRAS01-SCEC/X16', 'snetconf': '', 'netconf': 'netconf'}], [{'DEVICE_NAME': 'SNANK-MC-CMNET-BRAS01-SCEC/X16', 'snetconf': '', 'netconf': 'netconf'}, {'DEVICE_NAME': 'SNANK-MC-CMNET-BRAS01-SCEC/X16', 'snetconf': '', 'netconf': 'netconf'}, {'DEVICE_NAME': 'SNANK-MC-CMNET-BRAS01-SCEC/X16', 'snetconf': '', 'netconf': 'netconf'}]], '华为设备核对snetconf :\\n')}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "D:\\python\\mysoftware\\网络配置解析3.0\\templates\\核对IPM配置.textfsm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "try\n",
      "except\n",
      "finally\n"
     ]
    }
   ],
   "source": [
    "try:\n",
    "    print(\"try\")\n",
    "    1/0\n",
    "except:\n",
    "    print(\"except\")\n",
    "else:\n",
    "    print(\"else\")\n",
    "finally:\n",
    "    print(\"finally\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "json_str = '                      \\n \"name1\": \"John\", \"age\": 30, \"city\": \\n\"New York\"}'\n",
    "data = json.loads(json_str)\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['ArithmeticError']\n"
     ]
    }
   ],
   "source": [
    "string = '''       ArithmeticError   \n",
    "\n",
    "\n",
    "\n",
    "'''\n",
    "new_string = string.strip()\n",
    "print([new_string])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'text55501.txt'"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import shutil\n",
    "\n",
    "source_file = 'text555.txt'\n",
    "destination_file = 'text55501.txt'\n",
    "\n",
    "shutil.copy(source_file, destination_file)\n",
    "# print('Copied file from {} to {}'.format(source_file, destination_file))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "PureWindowsPath('D:/python/001MySortWare/网络运维工具/test.py')"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pathlib import Path,PurePath\n",
    "file=PurePath(r'D:\\python\\001MySortWare\\网络运维工具\\test.py')\n",
    "file"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'.py'"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "file.suffix"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "D:\\python\\001MySortWare\\网络运维工具\\text555.txt\n"
     ]
    }
   ],
   "source": [
    "\n",
    "source_file = PurePath(r'D:\\python\\001MySortWare\\网络运维工具\\text555.txt')\n",
    "destination_file = PurePath('text555001.txt')\n",
    "\n",
    "# shutil.copy(source_file, destination_file)\n",
    "\n",
    "print(source_file.joinpath())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "'str' object has no attribute 'with_segments'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[15], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mPurePath\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mjoinpath\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43mr\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mD:\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mpython\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43m001MySortWare\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43m网络运维工具\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m5.txt\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n",
      "File \u001b[1;32md:\\python\\python312\\Lib\\pathlib.py:717\u001b[0m, in \u001b[0;36mPurePath.joinpath\u001b[1;34m(self, *pathsegments)\u001b[0m\n\u001b[0;32m    711\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mjoinpath\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39mpathsegments):\n\u001b[0;32m    712\u001b[0m \u001b[38;5;250m    \u001b[39m\u001b[38;5;124;03m\"\"\"Combine this path with one or several arguments, and return a\u001b[39;00m\n\u001b[0;32m    713\u001b[0m \u001b[38;5;124;03m    new path representing either a subpath (if all arguments are relative\u001b[39;00m\n\u001b[0;32m    714\u001b[0m \u001b[38;5;124;03m    paths) or a totally different path (if one of the arguments is\u001b[39;00m\n\u001b[0;32m    715\u001b[0m \u001b[38;5;124;03m    anchored).\u001b[39;00m\n\u001b[0;32m    716\u001b[0m \u001b[38;5;124;03m    \"\"\"\u001b[39;00m\n\u001b[1;32m--> 717\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mwith_segments\u001b[49m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39mpathsegments)\n",
      "\u001b[1;31mAttributeError\u001b[0m: 'str' object has no attribute 'with_segments'"
     ]
    }
   ],
   "source": [
    "PurePath.joinpath(r'D:\\python\\001MySortWare\\网络运维工具','5.txt')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "ename": "KeyError",
     "evalue": "40",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mKeyError\u001b[0m                                  Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[11], line 2\u001b[0m\n\u001b[0;32m      1\u001b[0m b\u001b[38;5;241m=\u001b[39m{\u001b[38;5;241m1\u001b[39m:\u001b[38;5;241m2\u001b[39m,\u001b[38;5;241m3\u001b[39m:\u001b[38;5;241m4\u001b[39m,\u001b[38;5;241m5\u001b[39m:\u001b[38;5;241m6\u001b[39m,\u001b[38;5;241m6\u001b[39m:\u001b[38;5;241m7\u001b[39m,\u001b[38;5;241m8\u001b[39m:\u001b[38;5;241m9\u001b[39m,}\n\u001b[1;32m----> 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43mb\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpop\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m40\u001b[39;49m\u001b[43m)\u001b[49m)\n\u001b[0;32m      3\u001b[0m \u001b[38;5;28mprint\u001b[39m(b)\n",
      "\u001b[1;31mKeyError\u001b[0m: 40"
     ]
    }
   ],
   "source": [
    "b={1:2,3:4,5:6,6:7,8:9,}\n",
    "print(b.pop(40))\n",
    "print(b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "ename": "FileNotFoundError",
     "evalue": "[WinError 2] 系统找不到指定的文件。: 'text555.txt'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mFileNotFoundError\u001b[0m                         Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[8], line 3\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mos\u001b[39;00m\n\u001b[1;32m----> 3\u001b[0m \u001b[43mos\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mremove\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mtext555.txt\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n",
      "\u001b[1;31mFileNotFoundError\u001b[0m: [WinError 2] 系统找不到指定的文件。: 'text555.txt'"
     ]
    }
   ],
   "source": [
    "import os\n",
    "\n",
    "os.remove('text555.txt')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-963405514671-"
     ]
    }
   ],
   "source": [
    "import  uuid \n",
    "for i in range(545):\n",
    "    print(uuid.getnode(),end='-')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1703408315\n",
      "1703408316\n"
     ]
    }
   ],
   "source": [
    "import time\n",
    "print(int(time.time()))\n",
    "time.sleep(1)\n",
    "print(int(time.time()))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "31b0727f3a0c28a8bd1c6d2d05b7ffcc\n",
      "963405514671-1703840318-31b0727f3a0c28a8bd1c6d2d05b7ffcc\n"
     ]
    }
   ],
   "source": [
    "import hashlib\n",
    "esn=str(963405514671)\n",
    "end_time=str(int(time.time())+60*60*24*5)\n",
    "\n",
    "hash_object = hashlib.md5(f'{esn}{end_time}duanfu'.encode('utf-8'))\n",
    "\n",
    "hash_value = hash_object.hexdigest()\n",
    "print(hash_value)\n",
    "print(f'{esn}-{end_time}-{hash_value}')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "(unicode error) 'unicodeescape' codec can't decode bytes in position 127-128: truncated \\UXXXXXXXX escape (878888103.py, line 4)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Cell \u001b[1;32mIn[6], line 4\u001b[1;36m\u001b[0m\n\u001b[1;33m    bb='''{\u001b[0m\n\u001b[1;37m       ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m (unicode error) 'unicodeescape' codec can't decode bytes in position 127-128: truncated \\UXXXXXXXX escape\n"
     ]
    }
   ],
   "source": [
    "import json\n",
    "\n",
    "\n",
    "bb='''{\n",
    "    \"action\": \"input\",\n",
    "    \"type\": \"excel\",\n",
    "    \"output_table\": \"vty明细\",\n",
    "    \"args\": {\n",
    "        \"file\": r\"C:\\Users\\duanf\\Desktop\\组训\\vty是否合规汇总.xlsx\",\n",
    "        \"sheet\": \"vty整改20231222\",\n",
    "        \"header\": 1,\n",
    "        \"startrow\": 0\n",
    "    }\n",
    "}\n",
    "'''\n",
    "\n",
    "\n",
    "json.loads(bb)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'乙1columns454545'"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from  dfJinja import dfTemplate\n",
    " \n",
    "\n",
    "value=dfTemplate(\"{{地市  + 设备名称|string +'columns'}}{{'4545' '45'}}\").render({'地市': '乙', '设备名称': 1, 'vlan': 300})\n",
    "\n",
    "value\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[('host', '127.0.0.1'),\n",
       " ('user', 'root'),\n",
       " ('password', '123456'),\n",
       " ('port', '3306'),\n",
       " ('database', '[]')]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from configparser import ConfigParser\n",
    "cfg = ConfigParser()\n",
    "cfg.read(\"config.ini\")\n",
    "cfg.items(\"localdb\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'path': {'database_path': './statics/database', 'static_file': './statics', 'excel_sql_path': './statics/excel_sql', 'jinja2_filter_path': './statics/Jinja_filters.py'}}\n"
     ]
    }
   ],
   "source": [
    "import tomllib \n",
    "\n",
    "with open(\"config.toml\", \"rb\") as f:\n",
    "    data = tomllib.load(f)\n",
    "print(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "E:\\python\\MySoftware\\网络运维工具2.0\\test.py\n"
     ]
    }
   ],
   "source": [
    "with open(r'E:\\python\\MySoftware\\网络运维工具2.0\\test.py','r') as f:\n",
    "    print(f.name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'test'"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import  pathlib\n",
    "path=r'E:\\python\\MySoftware\\网络运维工具2.0\\test.py'\n",
    "pathlib.Path(path).name    \n",
    "pathlib.Path(path).stem  \n",
    "pathlib.Path(path).suffixes    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "bb=[{'华为设备核对snetconf': {'result': [111], 'status': True, 'error': ''}}, {'华为设备核对snetconf2': {'result': [111], 'status': True, 'error': ''}}, {' 华为设备核对snetconf3': {'result': [111], 'status': True, 'error': ''}}, {'华为设备核对snetconf4': {'result': [111], 'status': True, 'error': ''}}]  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'华为设备核对snetconf': {'result': [111], 'status': True, 'error': ''},\n",
       " '华为设备核对snetconf2': {'result': [111], 'status': True, 'error': ''},\n",
       " ' 华为设备核对snetconf3': {'result': [111], 'status': True, 'error': ''},\n",
       " '华为设备核对snetconf4': {'result': [111], 'status': True, 'error': ''}}"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result={}\n",
    "for b in bb:\n",
    "    result.update(b)\n",
    "result\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'joblib'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[11], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mjoblib\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Parallel, delayed\n\u001b[0;32m      2\u001b[0m Parallel(n_jobs\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m)\n",
      "\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'joblib'"
     ]
    }
   ],
   "source": [
    "from joblib import Parallel, delayed\n",
    "Parallel(n_jobs=-1)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
